package com.PAT.UnSatisfying;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/12/10/9:52
 * @Description: 正常情况下,从n中选m个,应该怎么选?
 * @Target: 首先输入,输出:三行(1.总成绩s1,2.成绩int[] arr1,3.需要核实的成绩数s2,核实的成绩arr2) 输出:核实成绩的个数
 *         一行直接进来的...只能数组分割
 *
 *         差6
 *
 */
public class 统计同成绩学生 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String SLine1 = in.nextLine();
        String SLine2 = in.nextLine();
        String SLine3 = in.nextLine();

        String[] s2 = SLine2.split(" ");
        String[] s3 = SLine3.split(" ");


        for (int i = 1; i < s3.length; i++) {
            int n = 0;
            for (int j = 0; j < s2.length; j++) {
                if (s3[i].equals(s2[j])==true){
                    n++;
                }
            }
            s3[i] = n+"";
        }


        for (int i = 1; i < s3.length; i++) {
            if (i!=s3.length-1){
                System.out.print(s3[i]+" ");
            }else {
                System.out.print(s3[i]);
            }
        }
    }

}
